package com.stu.day11.factory2;

import com.stu.day11.factory1.*;

/**
 * 工厂方法设计模式
 * 标准
 * @author zy
 * @date 2025/2/3 19:04
 */
public interface IBirdFactory {
    Flyable createFlyable();
}
class BirdAFactory implements IBirdFactory {
    @Override
    public Flyable createFlyable() {
        return new BirdA();
    }
}
class BirdBFactory implements IBirdFactory {
    @Override
    public Flyable createFlyable() {
        return new BirdB();
    }
}
class Factory3Test{
    public static void main(String[] args) {
        IBirdFactory ibfa = new BirdAFactory();
        IBirdFactory ibfb = new BirdBFactory();

        Flyable birdA = ibfa.createFlyable();
        Flyable birdB = ibfb.createFlyable();

        birdA.fly();
        birdB.fly();
    }
}
